#ifndef SPECIALABILITY_H
#define SPECIALABILITY_H

#include "dtwentyitem.h"


typedef DTwentyItem SpecialAbility;
Q_DECLARE_METATYPE(SpecialAbility)


//typedef DTwentyItemContainer<SpecialAbility> SpecialAbilityContainer;
class SpecialAbilityContainer : public DTwentyItemContainer<SpecialAbility>
{
    Q_OBJECT

    class Data : public QSharedData
    {
    public:
        Data()
        {
            level = 0;
        }

        Data(const Data& other) : QSharedData(other)
        {
            level = other.level;
        }

        int level;
    };

    Q_PROPERTY(int level READ level)

public:

    Q_INVOKABLE SpecialAbilityContainer(QObject* parent = 0) :
        DTwentyItemContainer<SpecialAbility>(QT_TR_NOOP("Special Abilities"), parent),
        d(new Data())
    {
    }

    SpecialAbilityContainer(int level, QObject* parent = 0) :
        DTwentyItemContainer<SpecialAbility>(QString("%1 %2").arg(QT_TR_NOOP("Level")).arg(level), parent),
        d(new Data())
    {
        d->level = level;
    }

    SpecialAbilityContainer(const SpecialAbilityContainer& other) :
        DTwentyItemContainer<SpecialAbility>(other),
        d(other.d)
    {
    }

    bool operator ==(int level)
    {
        return d->level == level;
    }

    bool operator <(int level)
    {
        return d->level < level;
    }

    int level() const
    {
        return d->level;
    }


private:

    QExplicitlySharedDataPointer<Data> d;


};
Q_DECLARE_METATYPE(SpecialAbilityContainer)


#endif // SPECIALABILITY_H
